package com.bdqn.springbootmybatisplus.controller;

import com.bdqn.springbootmybatisplus.pojo.SysUser;
import com.bdqn.springbootmybatisplus.service.SysUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * SysUserController
 *
 * @author LILIBO
 * @since 2021-11-27
 */
@RestController
@RequestMapping("/user")
public class SysUserController {

    @Resource
    private SysUserService sysUserService;

    @GetMapping("/test")
    public Object test() {
        System.out.println("---------------------- /user/update ----------------------");
        SysUser sysUser = sysUserService.getById(4L);
        sysUser.setUsrName("小苍。。。");
        sysUserService.updateById(sysUser);
        return sysUser;
    }

    @GetMapping("/list")
    public Object getList() {
        System.out.println("---------------------- /user/list ----------------------");
        SysUser query = new SysUser();
        query.setUsrRoleId(2L);
        return sysUserService.getList(query);
    }
}
